import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import axios from 'axios'

const instance = axios.create({
  baseURL: 'http://localhost:8888/api/private/v1',
  // headers: {
  //   'Authorization': token
  // }
});
instance.interceptors.request.use(function (config) {
  // console.log(config);
  if (config.url !== '/login') {
    var token = JSON.parse(localStorage.getItem('userinfo')).token

    config.headers.Authorization = token
  }
  return config
})


Vue.prototype.$axios = instance

Vue.use(ElementUI);
Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')